import { Modal, Input, InputNumber, Form, Select } from "antd";

import { DataType } from "./types";

interface EditUserProps {
  isModalOpen: boolean;
  handleOk: () => void;
  onCancel: () => void;
  form: any;
  currentUser: DataType | null;
}

export const EditUser: React.FC<EditUserProps> = ({
  isModalOpen,
  handleOk,
  onCancel,
  form,
  currentUser,
}) => {
  return (
    <Modal title="编辑用户" open={isModalOpen} onOk={handleOk} onCancel={() => onCancel()}>
      <Form form={form} layout="vertical" initialValues={currentUser || {}}>
        <Form.Item name="username" label="姓名" rules={[{ required: true, message: "请输入姓名" }]}>
          <Input />
        </Form.Item>

        <Form.Item name="roleId" label="角色" rules={[{ required: true, message: "请选择角色" }]}>
          <Select>
            <Select.Option value={0}>超级管理员</Select.Option>
            <Select.Option value={1}>普通用户</Select.Option>
          </Select>
        </Form.Item>
      </Form>
    </Modal>
  );
};
